package org.jsbd.boss.dao.impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.jsbd.boss.common.DataGridModel;
import org.jsbd.boss.dao.IBruchTaskDao;
import org.jsbd.boss.domian.BruchTaskBean;

import org.springframework.stereotype.Repository;

@Repository("bruchTaskDao")
public class BruchTaskDaoImpl extends CrackBaseDao implements IBruchTaskDao {

	@Override
	public void saveBruchTask(BruchTaskBean bruchTask) {
		super.insert("qy_channel_bruch_task.insert_qy_channel_bruch_task", bruchTask);
	}

	@Override
	public void updateBruchTask(BruchTaskBean bruchTask) {
		super.update("qy_channel_bruch_task.update_qy_channel_bruch_task", bruchTask);
	}

	@Override
	public BruchTaskBean getBruchTask(BruchTaskBean bruchTask) {
		return (BruchTaskBean) super.queryForObject("qy_channel_bruch_task.select_qy_channel_bruch_task_one", bruchTask);
	}

	@SuppressWarnings("unchecked")
	@Override
	public List<BruchTaskBean> getBruchTaskList(BruchTaskBean bruchTask) {
		return super.queryForList("qy_channel_bruch_task.select_qy_channel_bruch_task_list", bruchTask);
	}

	@Override
	public Map<String, Object> getBruchTaskListPage(DataGridModel page, BruchTaskBean form) {
		form = (form == null ? new BruchTaskBean() : form);
		form.setPageInfo(page);
		Map<String, Object> results = new HashMap<String, Object>();
		results.put("total", super.queryForCount("qy_channel_bruch_task.select_qy_channel_bruch_task_page_count", form));
		results.put("rows", super.queryForList("qy_channel_bruch_task.select_qy_channel_bruch_task_list", form));
		return results;
	}

	@Override
	public Integer getBruchTaskCount(BruchTaskBean bruchTask) {
		return super.queryForCount("qy_channel_bruch_task.select_qy_channel_bruch_task_page_count", bruchTask);
	}

	public void deleteBruchTask(BruchTaskBean bruchTask){
		super.insert("qy_channel_bruch_task.del_qy_channel_bruch_task", bruchTask);
	}

	
	@Override
	public void updateBruchTaskStatus(BruchTaskBean bruchTask) {
		super.update("qy_channel_bruch_task.update_qy_channel_bruch_task_status", bruchTask);
	}
	
}
